//
//  AppDelegate.m
//  LingQian
//
//  Created by xieyingze on 2018/1/21.
//  Copyright © 2018年 xieyingze. All rights reserved.
//

#import "AppDelegate.h"
#import "AppHeader.h"
#import "BaseTabBarController.h"
#import "ColorDefine.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

+ (instancetype)shareIntacenDelegate {
    return (AppDelegate *)[[UIApplication sharedApplication] delegate];
}

- (void)setRootViewController:(UIViewController*)controller {
    UIWindow* window = self.window;
    UIViewController* oldController = window.rootViewController;
    UIView *anview = oldController.view;
    anview.alpha = 1.0f;
    window.rootViewController = controller;
    
    [window addSubview:anview];
    [anview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@0);
    }];
    [UIView animateWithDuration:0.25 animations:^{
        anview.alpha = 0.0f;
    }completion:^(BOOL finished) {
        [anview removeFromSuperview];
    }];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //设置主题
    [[ThemeManager shareInstance] initConfiguration];
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = kCOLOR_white;
    self.window.rootViewController = [BaseTabBarController new];
    [self.window makeKeyAndVisible];
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
}


- (void)applicationWillTerminate:(UIApplication *)application {
}


@end
